import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import WindiCSS from 'vite-plugin-windicss'
//import path from 'path'
import { fileURLToPath, URL } from 'node:url'
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    WindiCSS(),
  ],
  //配置路由别名
  resolve:{
    alias:{
      //'~':path.resolve(__dirname,'src')
      '~': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  //跨域
  server:{
    proxy: {
      '/api': {
        target: 'http://localhost:8000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    }
  },
})
